﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using TestApplication.business.api;
using TestApplication.business.src;
using System.Windows.Threading;
using TestApplication.ViewModels;
using System.Threading;

namespace TestApplication
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private void OnStartup(object sender, StartupEventArgs e)
        {
            MainWindow view = new MainWindow();
            PluginServices pluginServices = new PluginServices(view);
            CaptureModel.Instance.PluginList = pluginServices.PluginList;
            view.InitializePluginButtons(pluginServices.PluginList);
            Thread captureModelThread = new Thread(new ThreadStart(CaptureModel.Instance.ThreadRun));
            captureModelThread.Name = "CaptureModelThread";
            captureModelThread.Start();
            view.Show();
        }

        private void APP_DispatcherUnhandledException(object sender,
            DispatcherUnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message);
            e.Handled = true;
        }
    }
}
